package com.ruoyi.car.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.car.mapper.PurchaseOrderMapper;
import com.ruoyi.car.domain.PurchaseOrder;
import com.ruoyi.car.service.IPurchaseOrderService;

/**
 * 购车订单（订单页、订单详情）Service业务层处理
 * 
 * @author yby
 * @date 2025-09-01
 */
@Service
public class PurchaseOrderServiceImpl implements IPurchaseOrderService 
{
    @Autowired
    private PurchaseOrderMapper purchaseOrderMapper;

    /**
     * 查询购车订单（订单页、订单详情）
     * 
     * @param id 购车订单（订单页、订单详情）主键
     * @return 购车订单（订单页、订单详情）
     */
    @Override
    public PurchaseOrder selectPurchaseOrderById(Long id)
    {
        return purchaseOrderMapper.selectPurchaseOrderById(id);
    }

    /**
     * 查询购车订单（订单页、订单详情）列表
     * 
     * @param purchaseOrder 购车订单（订单页、订单详情）
     * @return 购车订单（订单页、订单详情）
     */
    @Override
    public List<PurchaseOrder> selectPurchaseOrderList(PurchaseOrder purchaseOrder)
    {
        return purchaseOrderMapper.selectPurchaseOrderList(purchaseOrder);
    }

    /**
     * 新增购车订单（订单页、订单详情）
     * 
     * @param purchaseOrder 购车订单（订单页、订单详情）
     * @return 结果
     */
    @Override
    public int insertPurchaseOrder(PurchaseOrder purchaseOrder)
    {
        purchaseOrder.setCreateTime(DateUtils.getNowDate());
        return purchaseOrderMapper.insertPurchaseOrder(purchaseOrder);
    }

    /**
     * 修改购车订单（订单页、订单详情）
     * 
     * @param purchaseOrder 购车订单（订单页、订单详情）
     * @return 结果
     */
    @Override
    public int updatePurchaseOrder(PurchaseOrder purchaseOrder)
    {
        return purchaseOrderMapper.updatePurchaseOrder(purchaseOrder);
    }

    /**
     * 批量删除购车订单（订单页、订单详情）
     * 
     * @param ids 需要删除的购车订单（订单页、订单详情）主键
     * @return 结果
     */
    @Override
    public int deletePurchaseOrderByIds(Long[] ids)
    {
        return purchaseOrderMapper.deletePurchaseOrderByIds(ids);
    }

    /**
     * 删除购车订单（订单页、订单详情）信息
     * 
     * @param id 购车订单（订单页、订单详情）主键
     * @return 结果
     */
    @Override
    public int deletePurchaseOrderById(Long id)
    {
        return purchaseOrderMapper.deletePurchaseOrderById(id);
    }
}
